﻿@using Kovan.Model.Entity.UserCenter;
@{
    var item = Model as act_user;
    var depts = ViewBag.Depts as List<act_dept>;
    var roles = ViewBag.Roles as List<act_role>;
    
    var UserRoles= ViewBag.UserRoles as List<act_user_role>;
}
<div class="pageContent">
    <form method="post" action="@Url.Content("~/Manage/User/SaveUser")" class="pageForm required-validate"
    onsubmit="return UserManage.SaveUser(this, UserManage.dialogAjaxDone);">
    <div class="pageFormContent" layouth="56">
        <p>
            <label>
                用户名：</label>
            <input type="text" name="name" size="30" class="required" value="@item.name" />
            <input type="hidden" name="application_id" value="@item.application_id" />
            <input type="hidden" name="user_id" value="@item.user_id" />
        </p>
        <p>
            <label>
                登录名：</label>
            <input type="text" name="login_name" size="30"  value="@item.login_name" />
        </p>
        <p>
            <label>
                密码：</label>
            <input type="password" id="password" name="password" size="30" value="" />
        </p>
        <p>
            <label>
                证件号：</label>
            <input type="text" size="30" name="identity_card" value="@item.identity_card" />
        </p>
        <p>
            <label>
                电话：</label>
            <input type="text" size="30" name="phone_1" value="@item.phone_1" />
        </p>
        <p>
            <label>
                邮箱：</label>
            <input type="text" size="30" name="email" value="@item.email" />
        </p>
        
        <p>
            <label>
                角色：</label>
            <select name="role">
                @foreach (var r in roles)
                {
                    <option value="@r.role_id" @((UserRoles != null && UserRoles.Count > 0 && UserRoles[0].role_id == r.role_id) ? "selected" : "")>@r.name</option>
                }
            </select>
        </p>
        <p>
            <label>
                部门：</label>
            <select name="dept_id">
                @foreach (var d in depts)
                {
                    <option value="@d.dept_id" @(item.dept_id == d.dept_id ? "selected" : "")>@d.name</option>
                }
            </select>
        </p>
        <p>
            <label>
                职位：</label>
            <input type="text" size="30" name="title" value="@item.title" />
        </p>
        
        
        <p>
            <label>
                是否激活：</label>
            <input type="checkbox" checked="checked" name="enabled" value="1" @(item.enabled == 1 ? "checked" : "")  />
        </p>
        
    </div>
    <div class="formBar">
        <ul>
            <!--<li><a class="buttonActive" href="javascript:;"><span>保存</span></a></li>-->
            <li>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="submit">
                            保存</button></div>
                </div>
            </li>
            <li>
                <div class="button">
                    <div class="buttonContent">
                        <button type="button" class="close">
                            取消</button></div>
                </div>
            </li>
        </ul>
    </div>
    </form>
</div>
